//
//  BoomDoubleDetailVC.m
//  bgms_d
//
//  Created by Mountain on 21/2/2019.
//  Copyright © 2019 lachesis-zhu. All rights reserved.
//

#import "BoomDoubleDetailVC.h"

@interface BoomDoubleDetailVC ()

@end

@implementation BoomDoubleDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"LIGHT MODE";
    [self.boomBtnArrays enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *tmp = obj;
        [tmp setBackgroundImage:[UIImage imageWithColor:kAppThemeColor] forState:UIControlStateNormal];
        [tmp setBackgroundImage:[UIImage imageWithColor:kAppGrayBgColor] forState:UIControlStateSelected];
    }];
    [self boomStyle:0];
    switch (self.boomType) {
        case flashingType:
            self.titleLabel.text = @"【Flashing】";
            self.voLabel.hidden = YES;
            break;
        case solidColorType:
            self.titleLabel.text = @"【Beat Pulse】";
            break;
        case beatMatchType:
            self.titleLabel.text = @"【Beat Match】";
            break;
        case beatPulseType:
            self.titleLabel.text = @"【Solid Color】";
            self.voLabel.hidden = YES;
            break;
        default:
            break;
    }
}

- (IBAction)boomSelectDown:(UIButton *)sender {
    [self.boomBtnArrays enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        UIButton *tmp = obj;
        tmp.selected = NO;
    }];
    sender.selected = YES;
    [self boomStyle:sender.tag];
}

- (void)boomStyle:(NSInteger)index
{
    UInt8 data[3];
    data[0] = 0x78;
    data[1] = index & 0xff;
    data[2] = (self.boomType - 1000) & 0xff;
    [[BLETransDeviceSingleton sharedInstance] characteristc:LED_CHARACTERISTIC_UUID sendHostCmd:data lenght:3];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
